package thread2;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

public class callable3 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask task = new FutureTask<>(()->{
            TimeUnit.SECONDS.sleep(3);
            return "back";
        });

        Thread thread = new Thread(task);
        thread.start();
        thread.join();
        System.out.println(task.get());
        System.out.println("end");
    }
}
